package com.elitesland.metadata.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * <pre>作用说明</pre>
 *
 * @author mir
 * @date 11/28/2020 10:50 PM
 */
@Entity
@Table(name = "meta_cat_table")
@org.hibernate.annotations.Table(appliesTo = "meta_cat_table", comment = "自选分类表定义")
@Data
@Accessors(chain = true)
@ApiModel(value = "自选分类表定义", description = "自选分类表定义")
public class MetaCatTableDO extends BaseModel implements Serializable {

    private static final long serialVersionUID = -431582404003218321L;

    @ApiModelProperty(value = "定义码")
    @Comment("定义码")
    @Column(nullable = false, unique = true)
    String defCode;

    @ApiModelProperty(value = "定义名称")
    @Comment("定义名称")
    @Column()
    String defName;

    @ApiModelProperty(value = "数据库表名")
    @Comment("数据库表名")
    @Column()
    String tableName;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MetaCatTableDO)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        MetaCatTableDO entity = (MetaCatTableDO) o;
        return getId().equals(entity.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}